import React from 'react';
import Editor from 'for-editor';
import {message} from 'antd';

export default class Markdown extends React.Component {

  constructor(props) {
    super(props);
    this.state = {
      editorValue: '',
    };
  }

  render() {
    return (
      <Editor
        value={this.state.editorValue}
        onChange={this.handleEditorChange}
        onSave={this.handleEditorSave}
      />
    );
  }

  handleEditorChange = (value) => {
    this.setState({
      editorValue: value,
    });
  }

  handleEditorSave = () => {
    message.success('Save success!');
  }
}